function Ct = getCt(n_seg, n_order)
    %#####################################################
    % STEP 2.1: finish the expression of Ct
    %
    %
    %
    %
    %
    n_poly_perseg = n_order + 1;
    d_order = n_poly_perseg / 2;
    rows = n_seg * n_poly_perseg; % 行数和原来的变量数一样 段数*每段的数量
    cols = 2*d_order + (n_seg-1) + (d_order-1)*(n_seg-1); % 首尾 + 中间航点 + 中间的自由变量
    Ct = zeros(rows, cols);
    for k = 1:d_order % 开始的d个约束 
        Ct(k, k) = 1;
    end
    for k = 1:d_order % 结束的d个约束
        i = (n_seg - 1) * n_poly_perseg + d_order + k;
        j = d_order + (n_seg-1) + k;
        Ct(i, j) = 1;
    end
    for k = 1:n_seg-1 % k 个 中间航点的位置 连续约束
        i = k * n_poly_perseg + 1;
        j = d_order +  k;
        Ct(i, j) = 1;
        Ct(i-d_order, j) = 1; % 前一段的末位置
    end
    for k = 1:n_seg-1 % 连续约束
        for d = 2:d_order
            i = k * n_poly_perseg + d;
            j = 2*d_order + (n_seg-1) +  (k-1)*(d_order-1) + d - 1;
            Ct(i, j) = 1; % 当前段开始的pva
            Ct(i - d_order, j) = 1; % 上一段末的pva
        end
    end
end